const Electron = require('electron')
const remote = Electron.remote
const Menu = remote.Menu
const MenuItem = remote.MenuItem

let menu = new Menu()

/**
 * 展示右键菜单
 * @param {Array} data 右键菜单数据
 */
function showRightMenu(data) {
    menu = new Menu()
    for (const { label, click } of data) {
        menu.append(new MenuItem({ label, click }))
    }
    menu.popup(remote.getCurrentWindow())
}

export { showRightMenu }
